#!/bin/tcsh -ef
#############################################################################
#                                                                           #
# Title: Analyze Container (NOT READY TO USE)                               #
#                                                                           #
# (C) 2dx.org, GNU Plublic License.                                         #
#                                                                           #
# Created..........: 05/19/2007                                             #
# Last Modification: 05/19/2007                                             #
# Author...........: 2dx.org                                                #
#                                                                           #
#############################################################################
#
# SORTORDER: 44
#
#$end_local_vars
#
# MANUAL: Single Particle Refinement (still under construction)
#
# DISPLAY: particle_size_sp2dx
# DISPLAY: symmetry_sp2dx
# DISPLAY: cont_folder_sp2dx
#
# DISPLAY: back_projection_method_sp2dx
# DISPLAY: projection_method_sp2dx
#
# DISPLAY: lp_particle_filter_sp2dx
# DISPLAY: lp_volume_filter_ana_sp2dx
# DISPLAY: lp_projection_filter_sp2dx
#
# DISPLAY: particle_masking_sp2dx
# DISPLAY: particle_masking_params_sp2dx
# DISPLAY: projection_masking_sp2dx
# DISPLAY: projection_masking_params_sp2dx
# DISPLAY: ave_weight_sp2dx
#
# DISPLAY: reconstruction_masking_sp2dx
# DISPLAY: reconstruction_masking_r_params_sp2dx
# DISPLAY: reconstruction_masking_h_params_sp2dx
# DISPLAY: reconstruction_masking_ellipse_params_sp2dx
#
#
#
#
set bin_2dx = ""
set proc_2dx = ""
#
set particle_size_sp2dx = ""
set symmetry_sp2dx = ""
set cont_folder_sp2dx = ""
#
set back_projection_method_sp2dx = ""
set projection_method_sp2dx = ""
set ave_weight_sp2dx = ""
#
set lp_particle_filter_sp2dx = ""
set lp_volume_filter_ana_sp2dx = ""
set lp_projection_filter_sp2dx = ""
set projection_masking_sp2dx = ""
set projection_masking_params_sp2dx = ""
#
set particle_masking_sp2dx = ""
set particle_masking_params_sp2dx = ""
#
set reconstruction_masking_sp2dx = ""
set reconstruction_masking_r_params_sp2dx = ""
set reconstruction_masking_h_params_sp2dx = ""
set reconstruction_masking_ellipse_params_sp2dx = ""
#
set cont_folder_sp2dx = ""
#
#$end_vars

echo "<<@progress: 1>>"

set scriptname = AnalyzeContainer

set cache_projections_sp2dx = "0"
set parallel_projection_sp2dx = "0"
set refinement_method_sp2dx = "0"
set missing_cone_sp2dx = "0"

set lp_volume_filter_incharge = $lp_volume_filter_ana_sp2dx

\rm -f LOGS/${scriptname}.results
echo "<<@evaluate>>"



source ${proc_2dx}/2dx_makedirs 
\rm -f SCRATCH/2dx_merge_dirfile_oneline.dat
\rm -f SCRATCH/2dx_SP_convergence.txt
\rm -f SCRATCH/2dx_SP_convergence_tree.txt
\rm -f container_stat.txt

cat 2dx_merge_dirfile.dat | tr "\n" " " > SCRATCH/2dx_merge_dirfile_oneline.dat
set dirlist = "`cat SCRATCH/2dx_merge_dirfile_oneline.dat`"
#set dirstack = `pwd`
#echo $dirstack

echo "set called now"
#rm mergevars_written_to_file.txt
set > mergevars_written_to_file.txt

set olddir = `pwd`

${bin_2dx}/2dx_singleparticle/AnalyzeContainer.exe

python ${bin_2dx}/2dx_singleparticle/image_output_2dx_absolut_path.py "$cont_folder_sp2dx/ContainerStatsTXT/picking_stat.txt" "Picking Stat Analyze" "$scriptname" 0

python ${bin_2dx}/2dx_singleparticle/image_plotter_analyze.py "$cont_folder_sp2dx/ContainerStatsTXT/cont_stat_analyze.txt" "$cont_folder_sp2dx/ContainerStatsPDF/cont_stat_analyze.pdf"
python ${bin_2dx}/2dx_singleparticle/image_output_2dx_absolut_path.py "$cont_folder_sp2dx/ContainerStatsPDF/cont_stat_analyze.pdf" "Container Stat Analyze" "$scriptname" 0

python ${bin_2dx}/2dx_singleparticle/angle_hist_plotter.py "$cont_folder_sp2dx/ContainerStatsTXT/cont_stat_analyze.txt" "$cont_folder_sp2dx/ContainerStatsPDF/angle_hist_analyze.pdf"
python ${bin_2dx}/2dx_singleparticle/image_output_2dx_absolut_path.py "$cont_folder_sp2dx/ContainerStatsPDF/angle_hist_analyze.pdf" "Container Angle Hist" "$scriptname" 0


echo "<<@progress: 100>>"

